package com.example.arffrecorder.graphics;

import com.example.arffrecorder.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

public class ImageAdapter extends BaseAdapter {
    private Context mContext;

    //array of the tiles for the main screen
    private Integer[] mThumbIds = {
            R.drawable.record
    };
    private String[] mThumbText = {
    		"Recorder"
    };
    
    public ImageAdapter(Context c) {
        mContext = c;
    }
    

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    /**
     *  create a new ImageView and Text for each item referenced by the Adapter
     */
    public View getView(int position, View convertView, ViewGroup parent) {
        View v;
        if(convertView==null){
        	LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        	v = li.inflate(R.layout.grid_row, null);
        	TextView tv = (TextView)v.findViewById(R.id.item_text);
        	tv.setText(mThumbText[position]);
        	ImageView iv = (ImageView)v.findViewById(R.id.item_image);
        	iv.setImageResource(mThumbIds[position]);
        }
        else{
        	v = convertView;
        }
        return v;
    	}

}
